package com.auto.survey.activity.adjustment.adjustment_high

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.auto.survey.activity.adjustment.adjustment_high.dao.AdjustmentRepository
import com.auto.survey.activity.adjustment.adjustment_high.entity.ProjectWithAllData
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

class HighAdjusMentModle : ViewModel() {

    val project = MutableLiveData<ProjectWithAllData?>()

    fun getProjectDetail(repository:AdjustmentRepository, projectId:Int) {
        viewModelScope.launch {
            val result = withContext(Dispatchers.IO) {
                repository.getProjectById(projectId)
            }
            project.value = result
        }
    }
}